home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / include / X11 / Xdmcp.h < prev    next >
C/C++ Source or Header  |  2006-04-12  |  7KB  |  191 lines

  1. /* $XdotOrg: xc/lib/Xdmcp/Xdmcp.h,v 1.2 2004/04/23 18:43:41 eich Exp $ */
  2. /* $Xorg: Xdmcp.h,v 1.7 2001/04/13 14:43:00 steve Exp $ */
  3. /*
  4.  * Copyright 1989 Network Computing Devices, Inc., Mountain View, California.
  5.  *
  6.  * Permission to use, copy, modify, and distribute this software and its
  7.  * documentation for any purpose and without fee is hereby granted, provided
  8.  * that the above copyright notice appear in all copies and that both that
  9.  * copyright notice and this permission notice appear in supporting
  10.  * documentation, and that the name of N.C.D. not be used in advertising or
  11.  * publicity pertaining to distribution of the software without specific,
  12.  * written prior permission.  N.C.D. makes no representations about the
  13.  * suitability of this software for any purpose.  It is provided "as is"
  14.  * without express or implied warranty.
  15.  *
  16.  */
  17. /* $XFree86: xc/lib/Xdmcp/Xdmcp.h,v 3.7 2003/07/09 15:27:29 tsi Exp $ */
  18.  
  19. #ifndef _XDMCP_H_
  20. #define _XDMCP_H_
  21.  
  22. #include <X11/Xmd.h>
  23.  
  24. #include <X11/Xfuncproto.h>
  25.  
  26. _XFUNCPROTOBEGIN
  27.  
  28. #define XDM_PROTOCOL_VERSION    1
  29. #define XDM_UDP_PORT        177
  30.  
  31. /* IANA has assigned FF0X:0:0:0:0:0:0:12B as the permanently assigned 
  32.  * multicast addresses for XDMCP, where X in the prefix may be replaced
  33.  * by any valid scope identifier, such as 1 for Node-Local, 2 for Link-Local,
  34.  * 5 for Site-Local, and so on.  We set the default here to the Link-Local
  35.  * version to most closely match the old IPv4 subnet broadcast behavior.
  36.  * Both xdm and X -query allow specifying a different address if a different
  37.  * scope is defined.
  38.  */
  39. #define XDM_DEFAULT_MCAST_ADDR6    "ff02:0:0:0:0:0:0:12b"
  40.  
  41. #define XDM_MAX_MSGLEN        8192
  42. #define XDM_MIN_RTX        2
  43. #define XDM_MAX_RTX        32
  44. #define XDM_RTX_LIMIT        7
  45. #define XDM_KA_RTX_LIMIT    4
  46. #define XDM_DEF_DORMANCY    (3 * 60)    /* 3 minutes */
  47. #define XDM_MAX_DORMANCY    (24 * 60 * 60)    /* 24 hours */
  48.  
  49. typedef enum {
  50.     BROADCAST_QUERY = 1, QUERY, INDIRECT_QUERY, FORWARD_QUERY,
  51.     WILLING, UNWILLING, REQUEST, ACCEPT, DECLINE, MANAGE, REFUSE,
  52.     FAILED, KEEPALIVE, ALIVE
  53. } xdmOpCode;
  54.  
  55. typedef enum {
  56.     XDM_QUERY, XDM_BROADCAST, XDM_INDIRECT, XDM_COLLECT_QUERY,
  57.     XDM_COLLECT_BROADCAST_QUERY, XDM_COLLECT_INDIRECT_QUERY,
  58.     XDM_START_CONNECTION, XDM_AWAIT_REQUEST_RESPONSE,
  59.     XDM_AWAIT_MANAGE_RESPONSE, XDM_MANAGE, XDM_RUN_SESSION, XDM_OFF,
  60.     XDM_AWAIT_USER_INPUT, XDM_KEEPALIVE, XDM_AWAIT_ALIVE_RESPONSE,
  61. #if defined(IPv6) && defined(AF_INET6)
  62.     XDM_MULTICAST, XDM_COLLECT_MULTICAST_QUERY,
  63. #endif
  64.     XDM_KEEP_ME_LAST
  65. } xdmcp_states;
  66.  
  67. #ifdef NOTDEF
  68. /* table of hosts */
  69.  
  70. #define XDM_MAX_STR_LEN 21
  71. #define XDM_MAX_HOSTS 20
  72. struct xdm_host_table {
  73.   struct sockaddr_in sockaddr;
  74.   char name[XDM_MAX_STR_LEN];
  75.   char status[XDM_MAX_STR_LEN];
  76. };
  77. #endif /* NOTDEF */
  78.  
  79. typedef CARD8    *CARD8Ptr;
  80. typedef CARD16    *CARD16Ptr;
  81. typedef CARD32    *CARD32Ptr;
  82.  
  83. typedef struct _ARRAY8 {
  84.     CARD16    length;
  85.     CARD8Ptr    data;
  86. } ARRAY8, *ARRAY8Ptr;
  87.  
  88. typedef struct _ARRAY16 {
  89.     CARD8    length;
  90.     CARD16Ptr    data;
  91. } ARRAY16, *ARRAY16Ptr;
  92.  
  93. typedef struct _ARRAY32 {
  94.     CARD8    length;
  95.     CARD32Ptr    data;
  96. } ARRAY32, *ARRAY32Ptr;
  97.  
  98. typedef struct _ARRAYofARRAY8 {
  99.     CARD8    length;
  100.     ARRAY8Ptr    data;
  101. } ARRAYofARRAY8, *ARRAYofARRAY8Ptr;
  102.  
  103. typedef struct _XdmcpHeader {
  104.     CARD16  version, opcode, length;
  105. } XdmcpHeader, *XdmcpHeaderPtr;
  106.  
  107. typedef struct _XdmcpBuffer {
  108.     BYTE    *data;
  109.     int        size;        /* size of buffer pointed by to data */
  110.     int        pointer;        /* current index into data */
  111.     int        count;        /* bytes read from network into data */
  112. } XdmcpBuffer, *XdmcpBufferPtr;
  113.  
  114. typedef struct _XdmAuthKey {
  115.     BYTE    data[8];
  116. } XdmAuthKeyRec, *XdmAuthKeyPtr;
  117.  
  118.  
  119. /* implementation-independent network address structure.
  120.    Equiv to sockaddr* for sockets and netbuf* for STREAMS. */
  121.  
  122. typedef char *XdmcpNetaddr;
  123.  
  124. extern int XdmcpWriteARRAY16(XdmcpBufferPtr buffer, ARRAY16Ptr array);
  125. extern int XdmcpWriteARRAY32(XdmcpBufferPtr buffer, ARRAY32Ptr array);
  126. extern int XdmcpWriteARRAY8(XdmcpBufferPtr buffer, ARRAY8Ptr array);
  127. extern int XdmcpWriteARRAYofARRAY8(XdmcpBufferPtr buffer, ARRAYofARRAY8Ptr array);
  128. extern int XdmcpWriteCARD16(XdmcpBufferPtr buffer, unsigned value);
  129. extern int XdmcpWriteCARD32(XdmcpBufferPtr buffer, unsigned value);
  130. extern int XdmcpWriteCARD8(XdmcpBufferPtr buffer, unsigned value);
  131. extern int XdmcpWriteHeader(XdmcpBufferPtr  buffer, XdmcpHeaderPtr  header);
  132.  
  133. extern int XdmcpFlush(int fd, XdmcpBufferPtr buffer, XdmcpNetaddr to, int tolen);
  134.  
  135. extern int XdmcpReadARRAY16(XdmcpBufferPtr buffer, ARRAY16Ptr array);
  136. extern int XdmcpReadARRAY32(XdmcpBufferPtr buffer, ARRAY32Ptr array);
  137. extern int XdmcpReadARRAY8(XdmcpBufferPtr buffer, ARRAY8Ptr array);
  138. extern int XdmcpReadARRAYofARRAY8(XdmcpBufferPtr buffer, ARRAYofARRAY8Ptr array);
  139. extern int XdmcpReadCARD16(XdmcpBufferPtr buffer, CARD16Ptr valuep);
  140. extern int XdmcpReadCARD32(XdmcpBufferPtr buffer, CARD32Ptr valuep);
  141. extern int XdmcpReadCARD8(XdmcpBufferPtr buffer, CARD8Ptr valuep);
  142. extern int XdmcpReadHeader(XdmcpBufferPtr buffer, XdmcpHeaderPtr header);
  143.  
  144. extern int XdmcpFill(int fd, XdmcpBufferPtr buffer, XdmcpNetaddr from, int *fromlen);
  145.  
  146. extern int XdmcpReadRemaining(XdmcpBufferPtr buffer);
  147.  
  148. extern void XdmcpDisposeARRAY8(ARRAY8Ptr array);
  149. extern void XdmcpDisposeARRAY16(ARRAY16Ptr array);
  150. extern void XdmcpDisposeARRAY32(ARRAY32Ptr array);
  151. extern void XdmcpDisposeARRAYofARRAY8(ARRAYofARRAY8Ptr array);
  152.  
  153. extern int XdmcpCopyARRAY8(ARRAY8Ptr src, ARRAY8Ptr dst);
  154.  
  155. extern int XdmcpARRAY8Equal(ARRAY8Ptr array1, ARRAY8Ptr array2);
  156.  
  157. extern void XdmcpGenerateKey (XdmAuthKeyPtr key);
  158. extern void XdmcpIncrementKey (XdmAuthKeyPtr key);
  159. extern void XdmcpDecrementKey (XdmAuthKeyPtr key);
  160. #ifdef HASXDMAUTH
  161. extern void XdmcpWrap(unsigned char *input, unsigned char *wrapper, unsigned char *output, int bytes);
  162. extern void XdmcpUnwrap(unsigned char *input, unsigned char *wrapper, unsigned char *output, int bytes);
  163. #endif
  164.  
  165. #ifndef TRUE
  166. #define TRUE    1
  167. #define FALSE    0
  168. #endif
  169.  
  170. #if !defined(Xalloc) && !defined(xalloc) && !defined(Xrealloc)
  171. extern void *Xalloc (unsigned long amount);
  172. extern void *Xrealloc (void *old, unsigned long amount);
  173. extern void Xfree(void *old);
  174. #endif
  175.  
  176. extern int XdmcpCompareKeys (XdmAuthKeyPtr a, XdmAuthKeyPtr b);
  177.  
  178. extern int XdmcpAllocARRAY16 (ARRAY16Ptr array, int length);
  179. extern int XdmcpAllocARRAY32 (ARRAY32Ptr array, int length);
  180. extern int XdmcpAllocARRAY8 (ARRAY8Ptr array, int length);
  181. extern int XdmcpAllocARRAYofARRAY8 (ARRAYofARRAY8Ptr array, int length);
  182.  
  183. extern int XdmcpReallocARRAY16 (ARRAY16Ptr array, int length);
  184. extern int XdmcpReallocARRAY32 (ARRAY32Ptr array, int length);
  185. extern int XdmcpReallocARRAY8 (ARRAY8Ptr array, int length);
  186. extern int XdmcpReallocARRAYofARRAY8 (ARRAYofARRAY8Ptr array, int length);
  187.  
  188. _XFUNCPROTOEND
  189.  
  190. #endif /* _XDMCP_H_ */
  191.